package com.example.yk

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.yk.entity.SearchEntityResult
import com.example.zk3.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class SearchViewModel:BaseViewModel() {
    val searchSuccess = MutableLiveData<SearchEntityResult>()
    val searchFail = MutableLiveData<String>()

    fun searchtj(){
        viewModelScope.launch {
            try {
                val result = apiServer.searchtj()
                searchSuccess.value = result
            }catch (e:Exception){
                searchFail.value = e.message
            }
        }
    }
}